package com.quzi.kettle.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StrPattern {

	public static boolean checkemail(String emailAddr) {
		if (null == emailAddr || "".equals(emailAddr)) {
			return false;
		}
		// Pattern p = Pattern.compile(" /^([a-zA-Z0-9]){6,20}$/");

		Pattern p = Pattern
				.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
		Matcher m = p.matcher(emailAddr);
		return m.matches();
	}

	public static boolean checkpswd(String pswd) {
		if (null == pswd || "".equals(pswd)) {
			return false;
		}
		Pattern p = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$");
		// /^([a-zA-Z0-9]){6,20}$/
		// Pattern p =
		// Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
		Matcher m = p.matcher(pswd);
		return m.matches();
	}
}
